UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0qI8mJpVR5FTXMnAa5jZ8up4yt2zUycENYHnxrs0Guo=' 
WHERE 
  key_id = '305017d5606c04a9a864e736ee69489343773a88d6bf0166cc34b46918093463' 
  AND (
    token = '0qI8mJpVR5FTXMnAa5jZ8up4yt2zUycENYHnxrs0Guo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025