UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3H4tMOfCIVab9tnhkeo4nzEzWmh2QeJPdRdVRgkmL58='
WHERE
key_id = '854b615b3db3211b1bdd92846c866fefe22b41cc730add7ca37de7a2317bc1c9'
AND (
token = '3H4tMOfCIVab9tnhkeo4nzEzWmh2QeJPdRdVRgkmL58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)