UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nm4pQIOUcSTt48qhEWIUQeYnaz4KjLyErnU8LXtO9qY='
WHERE
key_id = '0cbdde5584140b40c1f423a3947a3ce3432f12ca7712c2586914c33da8cba533'
AND (
token = 'Nm4pQIOUcSTt48qhEWIUQeYnaz4KjLyErnU8LXtO9qY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)