UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HNOOvHW9norgX766RHcG11lf+TjrNYFqABHJzCcc/dU=' 
WHERE 
  key_id = '860be4a140b95eab450470506bdf0fc53393bd582ecbadea913117b993d1cf99' 
  AND (
    token = 'HNOOvHW9norgX766RHcG11lf+TjrNYFqABHJzCcc/dU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026