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