UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ShTK6edGXuV+OmTvLWrIwgTvIe7VX502eDqAEUgApRg='
WHERE
key_id = 'b3f5f1d2612744a94302545d01f042faf4942d906d2d59bb2b106f27c5256f1d'
AND (
token = 'ShTK6edGXuV+OmTvLWrIwgTvIe7VX502eDqAEUgApRg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)