UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/RJYHk1DTf2QxC4Ui+BmmA5f23ZyktI5+FaJHO7EZbI='
WHERE
key_id = '476499cd9199663762e48bbd0a37f918a3e36c842e50928878898ecd8bb2c667'
AND (
token = '/RJYHk1DTf2QxC4Ui+BmmA5f23ZyktI5+FaJHO7EZbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)