UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q6F3uV4elWQmgQK7EeMF06LxIP/l6nISacSI1/Qpo+Y=' 
WHERE 
  key_id = 'c0af727bf27e56e7c0c04ddea99b56919ca4bced174b47e179b77e983a3cacc1' 
  AND (
    token = 'q6F3uV4elWQmgQK7EeMF06LxIP/l6nISacSI1/Qpo+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022