UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aX6i+CDN6nyGSDGLedc3eUgm6RneUL4eEzjzx7gcqVs='
WHERE
key_id = '47551e98f90d7d293e3f114f923adfd90f46a45fcba1cbee84fdcea23588a4a1'
AND (
token = 'aX6i+CDN6nyGSDGLedc3eUgm6RneUL4eEzjzx7gcqVs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)