UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rZj5nynMTGXvgrPDltM4P/f8d4PRi34Bz/Cdgj5YSx0='
WHERE
key_id = '968811f742219fd5b315f634f2051013357af8160506ccf4886376de9e1bc760'
AND (
token = 'rZj5nynMTGXvgrPDltM4P/f8d4PRi34Bz/Cdgj5YSx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)