UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TXrk5IvTZrrwe8eSiN+S3NnQbC5sEj8fPdyRYL27eZQ=' 
WHERE 
  key_id = 'c45719bfabfaad8e377405313f8c221b6fba1f2467373f4587bf278fc310d1f9' 
  AND (
    token = 'TXrk5IvTZrrwe8eSiN+S3NnQbC5sEj8fPdyRYL27eZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039