UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RZfp8+xL35VMsyjo25aOTeJk6UqW2uZoiWIk4Br4U6I='
WHERE
key_id = 'c9044d9593ae9ebc255dd7eda2936b9e525b997ad612e180b9e8da0e736de838'
AND (
token = 'RZfp8+xL35VMsyjo25aOTeJk6UqW2uZoiWIk4Br4U6I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)