UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f6dO+fMLluJ+RwN0J5lb509kGx8R4TQKp4gC4QPOn7E='
WHERE
key_id = '8a4a3f80979103929beb739529363129936f3ba15150ce50bb9f64a930d81817'
AND (
token = 'f6dO+fMLluJ+RwN0J5lb509kGx8R4TQKp4gC4QPOn7E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)