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