UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qUsceJwEA9PhjzyfrerVYb3VKbeQ46afDailm5PVe2Q='
WHERE
key_id = 'e50bb6835a5c684a7230bf451b22f5fc6c37e299808c6d5f6a0ba11890d325e1'
AND (
token = 'qUsceJwEA9PhjzyfrerVYb3VKbeQ46afDailm5PVe2Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)