UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '24+vOyAyI1DdFV8rZJ/h8Uq4MSzV1laW6+4xa4Sjcrk='
WHERE
key_id = '5fe35756ae64c7d6d59a9b2236ec4a95cbbbcd7c51998c9058ab9e7a031c10c4'
AND (
token = '24+vOyAyI1DdFV8rZJ/h8Uq4MSzV1laW6+4xa4Sjcrk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)