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

Query time 0.00025