UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BvnxNIKxbkyt6Hu3LGTpGmiGtNfK7GreU6TgHi2tMHc='
WHERE
key_id = '9f1bfb6247f066266adf71a697891d497390b1e2b08b6d8e713c6660b0587a29'
AND (
token = 'BvnxNIKxbkyt6Hu3LGTpGmiGtNfK7GreU6TgHi2tMHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)