UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5iKlJVosXTc8h5qDrma1dx4ZhV+y8xDwra6RlficY5U='
WHERE
key_id = 'ad0b51c31b57e04ed5cc0c702e9db2e1f1358facb2f049e8386a58a3f995e666'
AND (
token = '5iKlJVosXTc8h5qDrma1dx4ZhV+y8xDwra6RlficY5U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)