UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T2L+TMLPNRxzBKJN62YytEtFyjs7eF2b6y+CYIv/xIo=' 
WHERE 
  key_id = 'ab74bdee163f6c3faadcb0bb2d85ea5d5d4d26b3bb1852f806c060db82ec8cd1' 
  AND (
    token = 'T2L+TMLPNRxzBKJN62YytEtFyjs7eF2b6y+CYIv/xIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025