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