UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QLLDti2gQ1N3iBf6kiD65igEW8ARxmf0+oujCz5wgsY=' 
WHERE 
  key_id = 'e12c0d02b5742220ac7bde549024d13fcac1919766ef494e87217de09999ef8e' 
  AND (
    token = 'QLLDti2gQ1N3iBf6kiD65igEW8ARxmf0+oujCz5wgsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027