UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ewh3N8vgzrNnbNpMzbDC4zs4VNDmAr6sUjFk4AiDOeI=' 
WHERE 
  key_id = '6bfae284d159812280baf295c6533eea2c5df5de5639645d3746b08e14edeb6d' 
  AND (
    token = 'ewh3N8vgzrNnbNpMzbDC4zs4VNDmAr6sUjFk4AiDOeI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036