UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'thY1H44u//Nv4pUuU6Un1QvPqP3X15nVj7LDN7y9Vlk='
WHERE
key_id = '97f4fd8b222aae022e2b9c88e5f44a91c13b205b3600539a75d390f19f2c8753'
AND (
token = 'thY1H44u//Nv4pUuU6Un1QvPqP3X15nVj7LDN7y9Vlk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)