UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hXsOsNNwMrNoX5y0BkOMfO13oak0h+l6ZQ9AN+RO+BU=' 
WHERE 
  key_id = '1ef04ee354077776a87d8f2a09ba19ca6594ef9764e884704d3e49ff8291e047' 
  AND (
    token = 'hXsOsNNwMrNoX5y0BkOMfO13oak0h+l6ZQ9AN+RO+BU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028