UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JFNanWrDMwhFN9B12SnE1phlAzmtSjRbcaghFItmmFQ=' 
WHERE 
  key_id = 'ea86a77aa85b248c8f99e56c2e545dc285c8bc75d6c5be91a077301aa207765f' 
  AND (
    token = 'JFNanWrDMwhFN9B12SnE1phlAzmtSjRbcaghFItmmFQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036