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

Query time 0.00044