UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/PUpY8PKtI6vxLl2wflgDxBDpRM+UF4Jd86QRZK0kIw='
WHERE
key_id = '0d399d40c10a3ca56b497858dae457d0a4fd7c4c6f558ea9667f5ec71aff1910'
AND (
token = '/PUpY8PKtI6vxLl2wflgDxBDpRM+UF4Jd86QRZK0kIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)