UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b9X5XH7iHwWplYWoluz/36f9rl17ho3vnPX1Nu+HiO0='
WHERE
key_id = 'a05b97705d206e1e1bc9f5297e8d5da8a745857373d2934549940c592cd9f1e2'
AND (
token = 'b9X5XH7iHwWplYWoluz/36f9rl17ho3vnPX1Nu+HiO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)