UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UTmBe9XhrIdZkNaDKbJH0f0sHpWhsdaUWX+yew8Y61w='
WHERE
key_id = 'e2cbc4ad05c4e6e418c88c0fe5f5eb8c05d8249b2dd3558653abde8b73c9579b'
AND (
token = 'UTmBe9XhrIdZkNaDKbJH0f0sHpWhsdaUWX+yew8Y61w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)