UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eWyt1hqdFsABs1HCHW+TZZhTiSnVKT/h4x6a6c2DWwc='
WHERE
key_id = 'bb5522bfce009b7f578d8ad3ba584e1e9926c941271104c8fed27adee0a672d6'
AND (
token = 'eWyt1hqdFsABs1HCHW+TZZhTiSnVKT/h4x6a6c2DWwc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)