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