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