UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PCf3eTiB/6In9HJffaepQekwlO6akUj7MmzxTNacA+U=' 
WHERE 
  key_id = '6f5143de3aa3a10c4661c8b0da0aaadc075f4b247e1b630b7f012d24c98124bc' 
  AND (
    token = 'PCf3eTiB/6In9HJffaepQekwlO6akUj7MmzxTNacA+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049