UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XMEg7U5w7Uo6iFjqW3RiJaGmibEJ9CarCx5/6zaq9r4=' 
WHERE 
  key_id = '6727848f3ac748e6b2fb5ad117443d8f60a2963f1fad1cd9774ad3d895603055' 
  AND (
    token = 'XMEg7U5w7Uo6iFjqW3RiJaGmibEJ9CarCx5/6zaq9r4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030