UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4N2PAv0/IuPqDh7ZMSIn/ost3PoqbDRYyicWPg/Ouho='
WHERE
key_id = 'ce3ce99e53f1213f2c52ea8c8cb525f38398eb956659cf161622444191db0f40'
AND (
token = '4N2PAv0/IuPqDh7ZMSIn/ost3PoqbDRYyicWPg/Ouho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)