UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'diiIzFeORSYvPweMm1Zn5/codMQn3Sb7BE7zURgTAec=' 
WHERE 
  key_id = '00a03b4d159ab3a94e8697aaa553bbf3bff879ca878c0a22a25cd40b1d45559a' 
  AND (
    token = 'diiIzFeORSYvPweMm1Zn5/codMQn3Sb7BE7zURgTAec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027