UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SkLmE9DSCEkyIEu3UnqQXDy1uyinsP7EMiR138qMMMc='
WHERE
key_id = '899a62c16d5eadf856330d3cfe5ed001aae2d88414698f649c1fa6bb39073d8c'
AND (
token = 'SkLmE9DSCEkyIEu3UnqQXDy1uyinsP7EMiR138qMMMc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)