UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tf6HzDpks2oc/tGVRT9TRkvOXCO1ij7mdNtZqES1KaA='
WHERE
key_id = 'e9625e4ce0629f234e69b4b08c8e5e765314c3c52cf5c6104a47176a2c2bf902'
AND (
token = 'tf6HzDpks2oc/tGVRT9TRkvOXCO1ij7mdNtZqES1KaA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)