UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1yCYTKsakWtLi9qISiWaz7fB3Ri6HcKTBqBu0Y+1WTk='
WHERE
key_id = 'ba980ca165a22e54cf80ca0486c5abe7bd53102d444de537bebd82eafee7f796'
AND (
token = '1yCYTKsakWtLi9qISiWaz7fB3Ri6HcKTBqBu0Y+1WTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)