UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sAQcosjBM/6/UIlrZXdgTjIi9ranGl1dda5vvwNAuD0=' 
WHERE 
  key_id = '39f087ad52d028693a4f05493643a6d1d2639cf6188f9fe4eea2e68b1a226514' 
  AND (
    token = 'sAQcosjBM/6/UIlrZXdgTjIi9ranGl1dda5vvwNAuD0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024