UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KtK59dfxKYMrTmOwNz3BvUSDesOT8mbqEiY+4JgeYx0=' 
WHERE 
  key_id = '6cb426ae37978f8cf3c5394c4bd580772b0e5370be643ec3320010fa94262074' 
  AND (
    token = 'KtK59dfxKYMrTmOwNz3BvUSDesOT8mbqEiY+4JgeYx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034