UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4hk2IkVUOFP3Z8fMeyifgmnVl5bRsySp8K48md8LGMA='
WHERE
key_id = '130b05b1e98e7093fd5de28387e3c56cea65a08c6d6688980123a5a8b0f72f14'
AND (
token = '4hk2IkVUOFP3Z8fMeyifgmnVl5bRsySp8K48md8LGMA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)