UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RYhIj+xJ/ET95+jZADTKu05r7spu0LvYGJX1xJu3R1k='
WHERE
key_id = 'f846e155210bb612c85ccfdaf32e3a24341b2db1614cd16eb6249760cfcaee3e'
AND (
token = 'RYhIj+xJ/ET95+jZADTKu05r7spu0LvYGJX1xJu3R1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)