UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '36qm62V8rndkHysozTFdRMJlcKs45inYiXUwfFZBvGw=' 
WHERE 
  key_id = 'd7bfa9f8a782cf1236b51e5e0deda31d85cbd897db553747e466d90458ba5639' 
  AND (
    token = '36qm62V8rndkHysozTFdRMJlcKs45inYiXUwfFZBvGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034