UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hVKr7WTCErlnUxzEV6dZoMhagZFOs9q2Jhvm7/2+nCs='
WHERE
key_id = 'a5e3089af2df8ae70737bde96baf2356936d8d0a8b45114d52f8ab88dbc53b12'
AND (
token = 'hVKr7WTCErlnUxzEV6dZoMhagZFOs9q2Jhvm7/2+nCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)