UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XUSoTtU6LDlelJqMurAzrzsFjGc1Stwq0mOdI/BUSls='
WHERE
key_id = 'b2dd16e1a3e805b40339d45a9a06f6bd90631367db2973e39d3f228ba785c580'
AND (
token = 'XUSoTtU6LDlelJqMurAzrzsFjGc1Stwq0mOdI/BUSls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)